<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" th:href="@{/favicon.ico}"/>
    <link rel="bookmark" th:href="@{/favicon.ico}"/>
    <title>LangV</title>

    <link th:href="@{/css/style.css}" rel="stylesheet">
    <link th:href="@{/css/style-responsive.css}" rel="stylesheet">
    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script th:src="@{/js/html5shiv.js}"></script>
    <script th:src="@{/js/respond.min.js}"></script>
    <![endif]-->
    <style> /*v-clock 解决闪烁{{后端参数}}的问题，在id=app的div内声明v-clock即可*/
    [v-clock]{
        display: none;
    }
    </style>
</head>

<body class="mybody">

<!-- left side start-->
<!-- left side end-->

<!-- main content start-->

<!-- header section start-->
<div th:replace="common/header::top"></div>
<!-- header section end-->

<!-- page heading start-->
<!-- page heading end-->

<!--body wrapper start-->
<div class="wrapper  " >
    <div class="row ">
        <div th:replace="common/header::#user_header(activeUrl='fans.html')"></div>

        <div id="app" v-clock class="col-sm-10" style="left: 8.3%">
            <div style="margin-top: -80px">
            <section class="panel">
                <div class="panel-body">
                    <div class="col-md-12 col-sm-6"  >
                        <div  v-for="fan in fans"  >
                            <div class="panel-body">
                                <div class="media">
                                    <a class="pull-left" :href="'/user/toHome/'+(fan.username  )">
                                        <img style="border-radius: 50%;width: 75px; height: 75px" src="/images/photos/user2.png" alt="">
                                    </a>
                                    <div class="media-body">
                                        <address>
                                            <br>
                                            <a style="text-decoration: none"  :href="'/user/toHome/'+(fan.username )">
                                            <strong style="font-size: large">{{fan.username}}</strong>
                                            </a>
                                            <div>{{fan.signature}}
                                            </div>
                                        </address>
                                    </div>
                                </div>
                                <hr>
                            </div>
                        </div>
                        <div v-if="fans.length==0"  >
                            <div class="panel-body" >
                                <div class="media">
                                    <div class="media-body">
                                        <address>
                                            <br>
                                            <strong style="font-size: x-large;margin-left: 10.6cm">您还没有关注者，快去发布作品吧！</strong><br>
                                            <div>
                                            </div>
                                        </address>
                                    </div>
                                </div>
                            </div>

                        </div>
                        </div>
                    </div>
            </section>
            </div>
        </div>
    </div>
</div>
<!--body wrapper end-->
<!--footer section start-->
<!--footer section end-->
<div th:replace="common/header::footer"></div>


<!-- m  ain content end-->

<!-- Placed js at the end of the document so the pages load faster -->
<script th:src="@{/js/jquery-1.10.2.min.js}"></script>
<script th:src="@{/js/jquery-ui-1.9.2.custom.min.js}"></script>
<script th:src="@{/js/jquery-migrate-1.2.1.min.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
<script th:src="@{/js/modernizr.min.js}"></script>
<!--右边滑条样式-->
<!--<script src="js/jquery.nicescroll.js"></script>-->

<script th:src="@{/js/jquery.isotope.js}"></script>

<!--common scripts for all pages-->
<script th:src="@{/js/scripts.js}"></script>
<script th:src="@{/js/vue.min.js}"></script>
<script th:src="@{/js/axios.min.js}"></script>
<script >
    new Vue({
        el: '#app',
        data: {
            fans: [],
        },
        mounted(){
            //通过当前用户名获取到subscribe表信息
            axios.get('/subscription/search_fans/'+username).then(res=>{
                //遍历表信息
                res.data.forEach((subscribe)=>{
                    //把表中的被订阅者即youtuber字段作为username的查询条件查找其完整的user信息
                    axios.get('/user/getUsersInfo/'+subscribe.subscriber).then(res=>{
                        //得到user的信息再装入vue的youtubers数组中展现到前端页面
                        this.fans.push(res.data);

                    })
                })
            })
        },
        methods:{

        }
    })
</script>

</body>
</html>
